OracleDemo
by Mai Nguyen, NeXT Developer Support Team

Overview

The purpose of this example is to show some common  end-user operations in handling databases without any need for Database Kit programming.  
 In order to run this example, you need to have an Oracle server with a demo database installed. If you don't have an Oracle server, you can still follow the instructions on building the nib files to quickly put together a demo.
 
 In order to add a new record  either into the employee table or the department table, press on the appropriate Insert button and  type in the data into the tableview textfields. After each Insert operation, you need to explicitly save the record. Note that the unique keys for the Employee Record is the Employee ID, while the unique key for the Department Record is the Department No. Similarly, after a delete operation, you'll need to explicitly save the changes.

Program Organization

How to build the nib files
1) Build the Master TableView
Drag a DBTableView palette object into your main window. Drag a DBModule object into the IB suitcase. Select OracleDemo as the database model. Make the proper connections from the Deparment table  to the DBTableView. Set  the DBTableView to be editable via the Interface Builder Inspector Panel, so that data can be entered directly into its textfields.
2) Build the Detail TableView
Same steps as for the Mater TableView. The only difference is that you need to drag another DBModule object into the IB suitcase, and make the proper connections from the Employee table to the DBTableView.
3) Join the 2 tables
In order to join the 2 tables,  just drag and drop the employees relationship in the master DBModule onto the icon of the detail module in the NIB file. Note that employees will show up as a new connection of the Master DBModule under the Interface Builder Inspector Panel.
4) Build the buttons
Note that the Fetch operation needs to be connected to the fetchAllRecords of the Master DBModule.
Each TableView has its own insert, delete, and save to save the records corresponding to that particular table.

Note: You can use this NIB file as is without any coding for demo purposes and run it using IB Test Interface Mode.